import { RouteRecordRaw } from 'vue-router'
import NavBar from "@/components/nav-bar/index.vue"
import TabBar from "@/components/tab-bar/index.vue"


//配置路由参数
const routes: RouteRecordRaw[] = [
    { path:"/",
redirect:"/home",//重定向  (当你访问路由端口直接跳往此处)
},
    {  
        path: '/home',
        // component: () => import('../views/home/index.vue')
        components:{
            default:() => import('../views/home/index.vue') ,
            footer:TabBar,
        },
        meta:{
            title:"首页",
            icon:"home-o",
            inTabbar:true, // 标记当前项时需要在tabbar 上渲染
        },
    },
    {   
        path: '/category',
        components:{
            header:NavBar,
            default:() => import('../views/category/index.vue') ,
            footer:TabBar,
        },
        meta:{
            title:"分类",
            icon:"list-switch ",
            inTabbar:true, // 标记当前项时需要在tabbar 上渲染
        },
        
    },
    {  
        path: '/cart',
        components:{
            header:NavBar,
            default:() => import('../views/cart/index.vue') ,
            footer:TabBar,
        },
        meta:{
            title:"购物车",
            icon:"shopping-cart-o",
            inTabbar:true, // 标记当前项时需要在tabbar 上渲染
        },
    },
    {  
        path: '/mine',
        components:{
            header:NavBar,
            default:() => import('../views/mine/index.vue') ,
            footer:TabBar,
        },
        meta:{
            title:"我的",
            icon:"user-o",
            inTabbar:true, // 标记当前项时需要在tabbar 上渲染
        },
    },
    {  
        path: '/login',
        components:{
            header:NavBar,
            default:() => import('../views/login/index.vue') ,
        }
    },
    {  
        path: '/list',
        components:{
            header:NavBar,
            default:() => import('../views/list/index.vue') ,
        }
    },
    {  
        path: '/register',
        components:{
            header:NavBar,
            default:() => import('../views/register/index.vue') ,
        }
    },
    {  
        path: '/detail', 
        components:{
            header:NavBar,
            default:() => import('../views/detail/index.vue') ,
        },
        meta:{
            title:"商品详情",
        }
    },
    {  
        path: '/search', 
        components:{
            header:NavBar,
            default:() => import('../views/search/index.vue') ,
        },meta:{
            title:"搜索",
        }
    },
    {
        path: '/login',
        // component: () => import('../views/login/index.vue')
        components:{
            header:NavBar,
            default:() => import('../views/login/index.vue') ,
           
        }
    }
]

export default routes  